home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-21 | 2.0 KB | 69 lines | [TEXT/ttxt] |
- --<<<-
- -- Filename: ANIMSHP1.SX
-
- -- Other Files Required: (none)
-
- -- Purpose: To demonstrate how animation works, keeping the
- -- target list unchanged -- that is, without using
- -- TargetListAction
-
- -- Specialized Classes: (none)
-
- -- Instructions to User: Load this file; it displays a window,
- -- which is initially empty, then displays a 2D shape that
- -- changes from a cirle to a rounded rectangle to a rectangle.
- -- To start again, type: "goToBegin alp"
-
- -- Author: Douglas Kramer
-
- ------------------------------------------------------------------------
-
- -- Create a window
- global myWindow := new Window boundary:(new Rect x2:200 y2:200)
- myWindow.y := 40
- show myWindow
-
- -- Create the ActionList and ActionListPlayer
- global al := new ActionList
- global alp := new ActionListPlayer actionList:al scale:30 targetCount:24
-
- -- Create a blue circle and add it to the window and targets list
- global myShape := new TwoDShape target:(new Oval x2:80 y2:80)
- myShape.fill := new Brush color:blueColor
- myShape.x := 60
- myShape.y := 60
- append myWindow myShape
-
- -- Puts the shape on the target list
- alp.targets[1] := myShape
-
- -- Set an action to hide the shape at time 0
- global hideShape := new ScriptAction script:(a t p -> hide t) targetnum:1 time:0
-
- -- Set an action to show the shape at time 1
- global showShape := new ScriptAction script:(a t p -> show t) targetnum:1 time:1
-
- -- Set an action to set the shape to an oval
- global makeOval := new ShapeAction targetNum:1 time:1 \
- shape:(new Oval x2:80 y2:80)
-
- -- Set an action to change its shape
- global makeRoundRect := new ShapeAction targetNum:1 time:30 \
- shape:(new RoundRect x2:80 y2:80 rx:30 ry:30)
-
- -- Set another action to change its shape
- global makeRect := new ShapeAction targetNum:1 time:60 \
- shape:(new Rect x2:80 y2:80)
-
- -- Append actions to the ActionList
- append al hideShape
- append al showShape
- append al makeOval
- append al makeRoundRect
- append al makeRect
-
- -- Play the ActionListPlayer
- play alp
-
- -- To play again, type: goToBegin alp
-